<template>
  <div>
    <el-tabs v-model="activeValue" type="card" @tab-click="handleClick">
      <el-tab-pane v-for="item in typeList" :label="item.typename" :name="item.id.toString()"></el-tab-pane>
    </el-tabs>

    <msgList :types="activeValue" />

  </div>
</template>

<script>
import msgList from '../components/msglist.vue'
import { GetTypes } from '@/api/news.js'
export default {
  name: 'Name',
  components: { msgList },
  data() {
    return {
      activeValue: '',
      typeList: [],
    }
  },
  mounted() {
    this.getPid()
  },
  methods: {
    handleClick(tab,eve){
      this.activeValue = tab.name;
    },
    
    // 获取分类
    async getPid() {
      const { list } = await GetTypes({
        PageIndex: 1,
        PageSize: '10000'
      })
      this.typeList = list
      this.activeValue =  this.typeList[0].id.toString();
      console.log(this.typeList)
    }
  }
}
</script>
<style lang="scss">
</style>
